/**
 * FlashReport报表综合实例(动态数据源|动态报表类型)
 */
Ext.onReady(function() {

			var rownum = new Ext.grid.RowNumberer({
						header : 'NO',
						width : 28
					});

			var cm = new Ext.grid.ColumnModel([rownum, {
						header : '项目流水号',
						dataIndex : 'prj_sn',
						sortable : false,
						hidden:true
					}, {
						header:'项目编号',
						dataIndex:'prj_no',
						sortable:true
					},{
						header : '预算价',
						dataIndex : 'yusuanjia',
						sortable : true,
						renderer:function s(value)
						{
								return "<span style='color:red;'>"+value+"元</span>";
						}
					},{
						header:'结算价',
						dataIndex:'jiesuanjia',
						sortable:true,
						renderer:function s(value)
						{
								return "<span style='color:red;'>"+value+"元</span>";
						}
					},{
						header:'已付款',
						dataIndex:'yifukuan',
						sortable:true,
						renderer:function s(value)
						{
								return "<span style='color:red;'>"+value+"元</span>";
						}
					},{
						header:'未付款',
						dataIndex:'weifukuan',
						sortable:true,
						renderer:function s(value)
						{
								var value=value+"";
								if(value.indexOf("-")==-1)
								{
									return "<span style='color:red;'>"+value+"元</span>";
								}
								else
								{
									return "<span style='color:BB0DCE;font-size:22px;'>"+value+"元</span>";
								}
						}
					}]);
			
			var store = new Ext.data.Store({
						proxy : new Ext.data.HttpProxy({
									url : 'szglDemo.ered?reqCode=queryMoneyByPrjsn'
								}),
						reader : new Ext.data.JsonReader({
									totalProperty : 'TOTALCOUNT',
									root : 'ROOT'
								}, [{
											name : 'prj_sn'
										}, {
											name : 'prj_no'
										},{
											name:'yusuanjia'
										},{
											name:'jiesuanjia'
										},{
											name:'yifukuan'
										},{
											name:'weifukuan'
										}])
					});

			var bbar = new Ext.PagingToolbar({
						pageSize : 100,
						store : store,
						displayInfo : true,
						displayMsg : '显示{0}条到{1}条,共{2}条',
						plugins : new Ext.ux.ProgressBarPager(),
						emptyMsg : "没有符合条件的记录",
						items : ['-', '&nbsp;&nbsp;']
					});
			var grid = new Ext.grid.GridPanel({
						title : '<span style="font-weight:normal">项目费用统计<span style="color:BB0DCE;">（提示：紫色代表为i负数...）</span></span>',
						frame : true,
						//width : 250,
						height:90,
						maxSize : 250,
						autoScroll : true,
						region : 'west',
						split : true,
						collapsible : true,
						store : store,
						stripeRows : true,
						cm : cm,
						//bbar : bbar,
						viewConfig : {
			 forceFit : true
						},
						loadMask : {
							msg : '正在加载表格数据,请稍等...'
						}
					});

			store.on('beforeload', function() {
						this.baseParams = {
								start : 0,
								limit : bbar.pageSize
						};
					});

			store.load({
						params : {
							start : 0,
							limit : bbar.pageSize
						}
					});

			var panel = new Ext.Panel({
						title : '<span style="font-weight:normal">项目:<span style="color:red;">'+prj_no+'</span>的费用统计图表</span>',
						contentEl : 'my2DcChart_div',
						region : 'center'
					});

			var viewport = new Ext.Viewport({
						//layout : 'border',
						items : [grid, panel]
					});

		});